<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<% 
	String tip = (String)request.getAttribute("tip");
	String username = (String) request.getAttribute("username");
	String password = (String) request.getAttribute("password");
	String rePassword = (String) request.getAttribute("rePassword");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PaaS平台IDE--修改密码</title>
<script type="text/javascript" src="/daycodefront/res/js/validate_client.js"></script>
<link href="/daycodefront/res/css/default_layout.css" rel="stylesheet" type="text/css" />
<style type="text/css">

.title{ font-size: 25px; margin:50px auto 30px; width:450px;}
.inputPanel .tip{width: 250px; height:25px; margin-left: 300px; font-size: 14px; color: red; }
.inputPanel ul li{margin:20px auto; list-style: none;}
.inputPanel ul li label{display:inline-block; text-align:right; width:100px; margin-left:200px;}
.inputPanel ul li input{width:250px; height: 30px; line-height: 25px;}
.inputPanel ul li .validate input{width:80px; height: 30px; line-height: 30px; }
.inputPanel ul li .validate img:hover {cursor: pointer; }
.but_updatePass {padding-left: 110px; margin-left:200px;margin-top:30px; }
.but_updatePass img:hover {cursor: pointer; }
</style>
<script type="text/javascript">
//发送邮件
function updatePass(){
	var passwordFormat = "[a-zA-Z0-9]{6,18}$";
	var form = document.forms['updatepassForm'];
	if(form.password.value==""){
		alert("新密码不能为空！");
	}else if(!form.password.value.match(passwordFormat)){
		alert("密码由大小写字母、数字组成且长度为6到18！");
	}else if(form.rePassword.value==""){
		alert("确认密码不能为空！");
	}else if(form.validate.value==""){
		alert("请输入验证码！");
	}else if(form.password.value!=form.rePassword.value){
		alert("两次输入的密码不一样！");
	}else{
		form.submit();
	}
}

//重新获取验证图片
function reloadImage() {
	var verify=document.getElementById('image');
	    verify.setAttribute('src','/daycodefront/jpaas_jsp/image.jsp?it='+Math.random());
}
</script>
</head>
<body>
	<div id="header">
		<%@include file="header.jsp"%>
	</div>
	<div id="content_body">
		<div id="content">
			<div class="title">
				<label>修改密码</label>
			</div>
			<div class="inputPanel">
				<form name="updatepassForm" action="updatePass" method="post">
					<div>
						<ul>
							<li><label align="right">用户名：</label>&nbsp;&nbsp;<span id="usernameSpan"><%=username%></span> 
								<input id="username" type="hidden" name="username" /> 
							</li>
							<li>
								<label align="right">新密码：</label> 
								<input id="password" type="password" name="password" onblur="validateForm('password');"/> 
							</li>
							<li>
								<label align="right">确认密码：</label>
								<input id="rePassword" type="password" name="rePassword" onblur="validateForm('password');"/>
							</li>
							<li><span class="validate"><label align="right">验证码：</label>
								<input id="validate" type="text" name="validate" /> &nbsp;&nbsp;&nbsp;
								<img id="image" src="/daycodefront/jpaas_jsp/image.jsp" title="看不清楚，换一张" onclick="reloadImage();"/></span>
								<div class="tip" id="tip_server_validate"><s:fielderror fieldName="tipValidate"/><%=tip == null ? "" : tip%></div>
							</li>
						</ul>
					</div>
					<div class="but_updatePass">
						<img src="/daycodefront/image/but_updatePass.png"
							onmouseover="this.src='/daycodefront/image/but_updatePass1.png'"
							onmouseout="this.src='/daycodefront/image/but_updatePass.png'" 
							alt="修改密码" onclick="updatePass()" />
					</div>
				</form>
			</div>
		</div>
	</div>
	<div id="footer">
		<%@include file="footer.jsp"%>
	</div>
</body>
<script type="text/javascript" >

	function init(){
		document.getElementById("usernameSpan").innerHTML="<%=username!=null? username:""%>";
		var username = document.getElementById("username");
		var password = document.getElementById("password");
		var rePassword = document.getElementById("rePassword");
		username.value ="<%=username!=null? username:""%>" ;
		password.value ="<%=password!=null? password:""%>" ;
		rePassword.value = "<%=rePassword!=null? rePassword:""%>" ;
	}
	init();
</script>
</html>
